package cn.itcast.springmvc.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.springmvc.dao.ItemsMapper;
import cn.itcast.springmvc.pojo.Items;
import cn.itcast.springmvc.pojo.ItemsExample;

@Service
@Transactional
public class ItemServiceImpl implements ItemService {

	@Autowired
	private ItemsMapper itemsMapper;
	
	
	@Override
	public List<Items> getItemList() {
		ItemsExample example = new ItemsExample();
		List<Items> selectByExampleWithBLOBs = itemsMapper.selectByExampleWithBLOBs(example);
		return selectByExampleWithBLOBs;
	}


	@Override
	public Items selectByPrimayKey(Integer id) {
		Items selectByPrimaryKey = itemsMapper.selectByPrimaryKey(id);
		return selectByPrimaryKey;
	}


	@Override
	public void updateItem(Items items) {
		itemsMapper.updateByPrimaryKeySelective(items);
	//	itemsMapper.updateByPrimaryKey(items);
	//	itemsMapper.updateByPrimaryKeyWithBLOBs(items);
	}


}
